home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 256_02 / setctry.a < prev    next >
Encoding:
Text File  |  1988-01-06  |  2.4 KB  |  62 lines

  1. ;---------------------------------------------------------------------
  2. ;    ASM88 FILE:     SETCTRY.A    Set Country Data
  3. ;    ----------
  4. ;    WRITTEN:        25/10/87
  5. ;    -------
  6. ;    PURPOSE:        This is one of a series of files which take
  7. ;    -------         advantage of INT 21H functions under MS-DOS.
  8. ;                    In each case the error situation is marked by
  9. ;                    the carry flag being set.   We use the De Smet
  10. ;                    external variable '_carryf' to see whether the
  11. ;                    carry is set on return from the function.
  12. ;                    If so, the error code can be used to obtain
  13. ;                    information about the specific error.
  14. ;
  15. ;    USAGE:          int SETCTRY(country, &_carryf)
  16. ;    -----           int country;
  17. ;                    char *_carryf;
  18. ;
  19. ;                    If country > 0ffh then this value must be placed 
  20. ;                    in BX instead of AL and 0ffh must be placed in AL.   
  21. ;                    The country code is usually the International
  22. ;                    Telephone prefix code.
  23. ;
  24. ;    DEPENDENCIES:           De Smet C V 2.44+
  25. ;    ------------
  26. ;    Copyright 1987 - Cogar Computer Services Pty. Ltd
  27. ;---------------------------------------------------------------------
  28.  
  29. CSEG
  30. PUBLIC SETCTRY_
  31.  
  32. SETCTRY_:
  33.     push    bp    ; normal De Smet C start
  34.     mov    bp,sp    ; point to the stack
  35.     mov    ax,ds    ; and make ES common with DS
  36.     mov    es,ax
  37. ;----------------------------------------------------------------------
  38. ;  The unique programme follows.
  39. ;----------------------------------------------------------------------
  40.     mov    bx,[bp+4]    ; get country code
  41.     mov    dx,-1
  42.     mov    ah,38h    ; the function No.
  43.     mov    al,0ffh    ; ready for extended code
  44.     cmp    bx,0feh    ; see if we should use AL for code
  45.     ja    SETCTRY_INT
  46.     mov    al,bl    ; must be small code No.
  47.     xor    bx,bx    ; zero out BX
  48. SETCTRY_INT:
  49.     int    21h
  50.     jc    SETCTRY_ERROR    ; do this if error
  51.     jmp    SETCTRY_QUIT    ; else terminate normally
  52. SETCTRY_ERROR:
  53.     mov    si,[bp+6]    ; get address of '_carryf' variable
  54.     mov    byte [si],1    ; return with _carryf = 1
  55. ;----------------------------------------------------------------------
  56. ;  Normal programme termination.
  57. ;----------------------------------------------------------------------
  58. SETCTRY_QUIT:
  59.     pop    bp    ; restore starting conditions
  60.     ret
  61. ;----------------------------------------------------------------------
  62.